package com.leo.controller;

import com.leo.bean.Student;
import com.leo.service.IRedisService;
import com.leo.service.IStudentService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName RedisTestController
 * @Description
 * @Author wangss
 * @date 2020.09.21 17:39
 * @Version 1.0
 */
@RestController
@RequestMapping("/redis")
public class RedisTestController {

    @Resource
    private IRedisService redisService;

    @Resource
    private IStudentService studentService;

    @RequestMapping("/add")
    public void add() {
        redisService.add();
    }

    @RequestMapping("/get")
    public String get(String key) {
        return redisService.get(key);
    }

    @RequestMapping("/addString")
    public void addString() {
        redisService.addString();
    }

    @RequestMapping("/addStringRedis")
    public void addStringRedis() {
        redisService.addStringRedis();
    }

    @RequestMapping("/queryStudentBySno")
    public Student queryStudentBySno(String sno) {
        return studentService.queryStudentBySno(sno);
    }

    @RequestMapping("/queryStudentBySnoPut")
    public Student queryStudentBySnoPut(String sno) {
        return studentService.queryStudentBySnoPut(sno);
    }
}
